/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author lzw
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadApiResult } from '../sys/upload';
import { UploadFileParams } from '/#/axios';
const { ctxPath, adminPath } = useGlobSetting();

export interface FstCase extends BasicModel<FstCase> {
  name?: string; // 客户姓名
  caseSource?: string; // 数据来源
  bank?: string; // 放款银行
  orderId?: string; // 订单号
  phone?: string; // 联系电话
  idCard?: string; // 身份证号
  loanAmount?: number; // 放款金额
  oddCorpus?: number; // 剩余本金
  residualInterest?: number; // 剩余利息
  negotiatedInterest?: number; // 调解本金
  spv?: string; // SPV
  court?: string; // 处置法院
  modeRepayment?: string; // 还款方式
  caseHkr?: string; // 还款日
  periods?: number; // 还款期数
  caseStatus?: string; // 案件状态
  principal?: string; // 负责人
  principalId?: string; // 负责人id
  fstCaseFollowList?: any[]; // 子表列表
  fstRepaymentTableList?: any[]; // 子表列表
}

export const fstCaseList = (params?: FstCase | any) =>
  defHttp.get<FstCase>({ url: adminPath + '/operating/fstCase/list', params });

export const fstCaseListData = (params?: FstCase | any) =>
  defHttp.post<Page<FstCase>>({ url: adminPath + '/operating/fstCase/listData', params });

export const fstCaseListGrData = (params?: FstCase | any) =>
  defHttp.post<Page<FstCase>>({ url: adminPath + '/operating/fstCase/listGrData', params });

export const fstCaseForm = (params?: FstCase | any) =>
  defHttp.get<FstCase>({ url: adminPath + '/operating/fstCase/form', params });

export const fstCaseSave = (params?: any, data?: FstCase | any) =>
  defHttp.postJson<FstCase>({ url: adminPath + '/operating/fstCase/save', params, data });

export const fstCaseImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/operating/fstCase/importData',
      onUploadProgress,
    },
    params,
  );

export const fstCaseDelete = (params?: FstCase | any) =>
  defHttp.get<FstCase>({ url: adminPath + '/operating/fstCase/delete', params });
